import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_general/pages/stateController/communicationPage.dart';
import 'package:flutter_general/pages/stateController/stateControllerModel.dart';
import 'package:pkg_obz/export.dart';

class StateControllerPage extends PageStateful<StateControllerModel> {
  StateControllerPage()
      : super(
          title: "状态管理",
          pageModel: StateControllerModel(),
        );

  @override
  Widget content(BuildContext context) => Container(
        alignment: Alignment.center,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Obz(
              () => Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(pageModel.textData_01.value.toString()),
                  Text(pageModel.textData_02.value.toString()),
                ],
              ),
            ),
            Obz(
              () => Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(pageModel.textData_01.value.toString()),
                  Text(pageModel.textData_02.value.toString()),
                ],
              ),
            ),
            TextButton(onPressed: pageModel.add, child: Text("++")),
            TextButton(onPressed: pageModel.minus, child: Text("--")),
            TextButton(onPressed: pageModel.test, child: Text("延迟数据")),
            TextButton(
              onPressed: () => ZRouter.goTo(CommunicationPage()),
              child: Text("页面通信"),
            ),
          ],
        ),
      );
}
